<%
  ' Si el usuario no está conectado, redirigir a la página de inicio de sesión
  If Not Session("auth_granted") = "true" Then 
  	cadURL = "Login.asp"
	response.write "<script>window.open('"& cadURL & "','_top');</script>"
	Response.End
  End If 
%>
<!--#include file="Librerias/mssql-ds.dll" -->
<!--#include file="Librerias/security-ds.dll" -->
<!--#include file="Funciones/FuncionesGenerales.asp" -->
<link href="Estilos/EstilosPagina.css" rel="stylesheet" type="text/css">

<script language="javascript">
function CargarObjetivosEstrategicos(vID, vCARPETAS, vFOLDER){
	for (i=0;i<=vCARPETAS;i++){
		document.getElementById('celda'+i).style.backgroundColor='#FFFFFF';
	}
	window.open('FrameObjetivosEstrategicos.asp?qIdentificador='+vID+'&qCarpeta='+vFOLDER, 'frameOBJESTRATEGICOS');
	window.open('Vacio.asp', 'frameOBJGESTION');
	window.open('Vacio.asp', 'framePRODUCTOS');
	window.open('Vacio.asp', 'frameINSUMOS');
}
</script>

<%
'// Recuperar la gestion de trabajo
qGestion = Session("auth_granted_poa_gestion")

sSQL = ""
sSQL = sSQL & " SELECT poa_id"
sSQL = sSQL & " FROM POA"
sSQL = sSQL & " WHERE (aper_id IN ("
sSQL = sSQL & " SELECT aper_id"
sSQL = sSQL & " FROM AperturaProgramatica"
sSQL = sSQL & " WHERE (aper_programa IN ("
sSQL = sSQL & " SELECT aper_programa"
sSQL = sSQL & " FROM AperturaProgramatica"
sSQL = sSQL & " WHERE (aper_id = "& Session("auth_granted_poa_apertura_programatica") &")"
sSQL = sSQL & " AND (aper_gestion = "& qGestion &")))"
sSQL = sSQL & " AND (aper_proyecto = '0000')"
sSQL = sSQL & " AND (aper_actividad = '000')"
sSQL = sSQL & " AND (aper_gestion = "& qGestion &")))"
DatoCarpeta = RecordBD(sSQL, "poa_id",1)

If Trim(DatoCarpeta) = "none" Then
	sSQL = ""
	sSQL = sSQL & " SELECT poa_id, poa_codigo, aper_id, uni_id, fun_id, poa_fecha_creacion"
	sSQL = sSQL & " FROM POA"
	sSQL = sSQL & " WHERE (poa_estado = 1) AND (poa_gestion = "& qGestion &")"
Else
	sSQL = ""
	sSQL = sSQL & " SELECT poa_id, poa_codigo, aper_id, uni_id, fun_id, poa_fecha_creacion"
	sSQL = sSQL & " FROM POA"
	sSQL = sSQL & " WHERE (poa_estado = 1) AND (poa_gestion = "& qGestion &")"
	sSQL = sSQL & " AND (poa_id = "& DatoCarpeta &")"
End If
MatrizCarpetas = MatrixBD(sSQL, 1)
If VarType(MatrizCarpetas) = 8  then
	RegistrosCarpetas = -1
Else
	RegistrosCarpetas = UBound(MatrizCarpetas,2)	
End If
%>
        
<table width="100%" border="1" cellspacing="0" cellpadding="1" align="justify" bordercolor="#999999" style="border-collapse:collapse;" bgcolor="#FFFFFF">
  <% For ca = 0 To RegistrosCarpetas %>
  <tr id="celda<%=ca%>">
    <td align="center"><input name="imagen" type="image" onClick="CargarObjetivosEstrategicos(<%=MatrizCarpetas(0,ca)%>, <%=RegistrosCarpetas%>, <%=MatrizCarpetas(2,ca)%>); document.getElementById('celda<%=ca%>').style.backgroundColor='#FEE363';" src="Iconos/bullet_gray.png"></td>
    <td><%=AperturaProgramaticaCompuesta(MatrizCarpetas(2,ca))%></td>
  </tr>
  <% Next %>
</table>
